/*
 * heap_sort.c
 *
 *  Created on: Mar 25, 2014
 *      Author: jack
 */
#include <stdio.h>
void print_array(int arr[], int len) {
	int i;
	for (i = 0; i < len - 1; i++) {
		printf("%d,", arr[i]);
	}
	printf("%d\n", arr[i]);
}

void print_sub_array(int arr[], int start, int end) {
	int i;
	for (i = start; i < end; i++) {
		printf("%d,", arr[i]);
	}
	printf("%d\n", arr[i]);
}

int main() {
	int arr[8] = { 49, 38, 65, 97, 76, 13, 27, 49 };
	int len = 8;
	printf("Original Array:\n");
	print_array(arr, len);

	/*//插入排序
	 insert_sort(ar,8);
	 */

	/*//希尔排序
	 shell_sort(arr,len);
	 */

	/*//冒泡排序
	 bubble_sort(arr,len);
	 */

	/*// 选择排序
	 select_sort(arr,len);
	 */

	/*//归并排序
	 int brr[8]={0};
	 merge_sort(arr,brr,0,len-1);
	 */

	/*
	//快速排序
	quick_sort(arr, 0, len - 1);
	*/

	//堆排序
	   heap_sort(arr,len);


	printf("After sort:\n");
	print_array(arr, len);
	return 0;
}
